package nc.ui.mmpac.sumpickm.serviceproxy;

import java.util.List;

import nc.bs.framework.common.NCLocator;
import nc.itf.mmpac.sumpickm.ISumPickmQueryService;
import nc.ui.mmpac.sumpickm.model.SumPickmManageModel;
import nc.ui.pubapp.uif2app.query2.model.IQueryService;
import nc.ui.querytemplate.querytree.IQueryScheme;
import nc.vo.mmpac.pickm.entity.PickmViewVO;
import nc.vo.mmpac.sumpickm.entity.SumPickmSumDimVO;
import nc.vo.pub.BusinessException;
import nc.vo.pubapp.pattern.exception.ExceptionUtils;

public class SumPickmQueryProxy implements IQueryService {
    private SumPickmManageModel model;

    @Override
    public Object[] queryByQueryScheme(IQueryScheme queryScheme) throws Exception {
        ISumPickmQueryService query = NCLocator.getInstance().lookup(ISumPickmQueryService.class);
        return query.queryByQueryScheme(queryScheme, Integer.valueOf(this.model.getProdMode()));
    }

    public SumPickmSumDimVO querySumDimVO(String pk_group, String pk_org, String userid) throws Exception {
        ISumPickmQueryService query = NCLocator.getInstance().lookup(ISumPickmQueryService.class);
        return query.querySumDimVO(pk_group, pk_org, userid);
    }

    public SumPickmManageModel getModel() {
        return this.model;
    }

    public void setModel(SumPickmManageModel model) {
        this.model = model;
    }

    public PickmViewVO[] transToPickmViewVO(List<String> hids) {
        ISumPickmQueryService query = NCLocator.getInstance().lookup(ISumPickmQueryService.class);
        try {
            return query.transToPickmViewVO(hids);
        }
        catch (BusinessException e) {
            ExceptionUtils.wrappException(e);
        }
        return null;
    }

    public PickmViewVO[] transToPickmViewVOBySids(String[] sids) {
        ISumPickmQueryService query = NCLocator.getInstance().lookup(ISumPickmQueryService.class);
        try {
            return query.querySumPickmViewVOs(sids);
        }
        catch (BusinessException e) {
            ExceptionUtils.wrappException(e);
        }
        return null;
    }
}
